package domain.grammar;

import java.util.Iterator;
import java.util.Set;

import domain.regularExpression.RegularExpressionElement;

public class ExtendedGrammarConflictException extends Exception {
	private Set<RegularExpressionElement> _elemsInConflict;
	
	public ExtendedGrammarConflictException(Set<RegularExpressionElement> elemsInConflict){
		_elemsInConflict = elemsInConflict;
	}
	
	
	public String getMessage(){
		String message = "The grammar has the following nodes with conflicts:\n";
		Iterator<RegularExpressionElement> itElemsInConflict = _elemsInConflict.iterator();
		while(itElemsInConflict.hasNext()){
			message = message + itElemsInConflict.next().toString()+"\n";
		}
		return message;
	}
	
	public String toString(){
		return getMessage();
	}
	
	
}
